'''
factory class for rendering system UI templates.
'''
import os
from jinja2 import Environment, FileSystemLoader


class template_ui(Environment, FileSystemLoader):
    '''
    Factory class for template rendering engine
    '''
    def __init__(self, ):
        '''
        Setup 
        '''
        templateDir = 'templates'
        self.env = Environment(loader=FileSystemLoader(os.getcwd() + '/' + templateDir))
    
    
    
    def __getTemplate(self, templateName='error.html'):
        '''
        Return Error page if template is not found...
        '''
         
        return self.env.get_template(templateName)
    
    def render(self, template_name, data):
        template = self.__getTemplate(template_name)
        
        return template.render(data)






